INCDIR=../include/onnc

ONNC_SOURCES = \
	IRReader/ONNXReader.cpp \
	IR/ComputeRegOperand.cpp \
	IR/ComputeMemOperand.cpp \
	IR/ComputeOperand.cpp \
	IR/ComputeOperator.cpp \
	IR/ComputeGraph.cpp \
	IR/Module.cpp \
	IR/Dump.cpp \
	IR/Define.cpp \
	IR/ONNXNodeVisitor.cpp \
	IR/ONNXUtils.cpp \
	IR/Quadruple.cpp \
	IR/InsertionPoint.cpp \
	IR/IRBuilder.cpp \
	IR/ONNCModulePrinter.cpp \
	IR/CodeEmit.cpp \
	IR/Compute/ATen.cpp \
	IR/Compute/Abs.cpp \
	IR/Compute/Acos.cpp \
	IR/Compute/Add.cpp \
	IR/Compute/Affine.cpp \
	IR/Compute/And.cpp \
	IR/Compute/ArgMax.cpp \
	IR/Compute/ArgMin.cpp \
	IR/Compute/Asin.cpp \
	IR/Compute/Atan.cpp \
	IR/Compute/Attributes.cpp \
	IR/Compute/AveragePool.cpp \
	IR/Compute/BatchNormalization.cpp \
	IR/Compute/Cast.cpp \
	IR/Compute/Ceil.cpp \
	IR/Compute/Clip.cpp \
	IR/Compute/Concat.cpp \
	IR/Compute/ConstantFill.cpp \
	IR/Compute/Conv.cpp \
	IR/Compute/ConvTranspose.cpp \
	IR/Compute/Cos.cpp \
	IR/Compute/Crop.cpp \
	IR/Compute/DepthToSpace.cpp \
	IR/Compute/Div.cpp \
	IR/Compute/Dropout.cpp \
	IR/Compute/Elu.cpp \
	IR/Compute/Equal.cpp \
	IR/Compute/Exp.cpp \
	IR/Compute/Expand.cpp \
	IR/Compute/Flatten.cpp \
	IR/Compute/Floor.cpp \
	IR/Compute/GRU.cpp \
	IR/Compute/GRUUnit.cpp \
	IR/Compute/Gather.cpp \
	IR/Compute/Gemm.cpp \
	IR/Compute/GivenTensorFill.cpp \
	IR/Compute/GlobalAveragePool.cpp \
	IR/Compute/GlobalLpPool.cpp \
	IR/Compute/GlobalMaxPool.cpp \
	IR/Compute/Greater.cpp \
	IR/Compute/HardSigmoid.cpp \
	IR/Compute/Hardmax.cpp \
	IR/Compute/Identity.cpp \
	IR/Compute/ImageScaler.cpp \
	IR/Compute/Initializer.cpp \
	IR/Compute/InputOperator.cpp \
	IR/Compute/InstanceNormalization.cpp \
	IR/Compute/LRN.cpp \
	IR/Compute/LSTM.cpp \
	IR/Compute/LeakyRelu.cpp \
	IR/Compute/Less.cpp \
	IR/Compute/Log.cpp \
	IR/Compute/LogSoftmax.cpp \
	IR/Compute/LpNormalization.cpp \
	IR/Compute/LpPool.cpp \
	IR/Compute/MatMul.cpp \
	IR/Compute/Max.cpp \
	IR/Compute/MaxPool.cpp \
	IR/Compute/MaxRoiPool.cpp \
	IR/Compute/Mean.cpp \
	IR/Compute/MeanVarianceNormalization.cpp \
	IR/Compute/Min.cpp \
	IR/Compute/Mul.cpp \
	IR/Compute/Multinomial.cpp \
	IR/Compute/Neg.cpp \
	IR/Compute/Not.cpp \
	IR/Compute/Or.cpp \
	IR/Compute/OutputOperator.cpp \
	IR/Compute/PRelu.cpp \
	IR/Compute/Pad.cpp \
	IR/Compute/ParametricSoftplus.cpp \
	IR/Compute/Pow.cpp \
	IR/Compute/RNN.cpp \
	IR/Compute/RandomNormal.cpp \
	IR/Compute/RandomNormalLike.cpp \
	IR/Compute/RandomUniform.cpp \
	IR/Compute/RandomUniformLike.cpp \
	IR/Compute/Reciprocal.cpp \
	IR/Compute/ReduceL1.cpp \
	IR/Compute/ReduceL2.cpp \
	IR/Compute/ReduceLogSum.cpp \
	IR/Compute/ReduceLogSumExp.cpp \
	IR/Compute/ReduceMax.cpp \
	IR/Compute/ReduceMean.cpp \
	IR/Compute/ReduceMin.cpp \
	IR/Compute/ReduceProd.cpp \
	IR/Compute/ReduceSum.cpp \
	IR/Compute/ReduceSumSquare.cpp \
	IR/Compute/Relu.cpp \
	IR/Compute/Reshape.cpp \
	IR/Compute/Scalar.cpp \
	IR/Compute/Scale.cpp \
	IR/Compute/ScaledTanh.cpp \
	IR/Compute/Selu.cpp \
	IR/Compute/Shape.cpp \
	IR/Compute/Sigmoid.cpp \
	IR/Compute/Sin.cpp \
	IR/Compute/Size.cpp \
	IR/Compute/Slice.cpp \
	IR/Compute/Softmax.cpp \
	IR/Compute/Softplus.cpp \
	IR/Compute/Softsign.cpp \
	IR/Compute/SpaceToDepth.cpp \
	IR/Compute/Split.cpp \
	IR/Compute/Sqrt.cpp \
	IR/Compute/Squeeze.cpp \
	IR/Compute/Sub.cpp \
	IR/Compute/Sum.cpp \
	IR/Compute/Tan.cpp \
	IR/Compute/Tanh.cpp \
	IR/Compute/Tensor.cpp \
	IR/Compute/ThresholdedRelu.cpp \
	IR/Compute/Tile.cpp \
	IR/Compute/TopK.cpp \
	IR/Compute/Transpose.cpp \
	IR/Compute/Unsqueeze.cpp \
	IR/Compute/Upsample.cpp \
	IR/Compute/Use.cpp \
	IR/Compute/Value.cpp \
	IR/Compute/Xor.cpp \
	IR/Tensor/InitializerProxy.cpp \
	Transforms/DeadNodeElimination.cpp \
	Transforms/RemoveTrainingNodes.cpp \
	Transforms/BookONNXGraphs.cpp \
	Transforms/GraphBuildingPass.cpp \
	Transforms/BuildInitializers.cpp \
	Transforms/BuildInputOperators.cpp \
	Transforms/BuildOutputOperators.cpp \
	Transforms/OnnxOptPass.cpp \
	Transforms/Optimizations/DivideGlobalAPIntoAPs.cpp \
	Transforms/Optimizations/EliminateIdentity.cpp \
	Transforms/Optimizations/ExpandBatchNormalization.cpp \
	Transforms/Optimizations/OptimizationsUtils.cpp \
	Transforms/Optimizations/PropagateConstWithDiffShape.cpp \
	Transforms/Optimizations/ReplaceGemmByConv.cpp \
	Transforms/Optimizations/SplitConvPass.cpp \
	Transforms/TensorSel.cpp \
	Transforms/TensorSel/DefaultAttributes.cpp \
	Transforms/TensorSel/Lower.cpp \
	Transforms/TensorSel/LowerRegistry.cpp \
	Transforms/TensorSel/AbsLower.cpp \
	Transforms/TensorSel/AcosLower.cpp \
	Transforms/TensorSel/AddLower.cpp \
	Transforms/TensorSel/AffineLower.cpp \
	Transforms/TensorSel/AndLower.cpp \
	Transforms/TensorSel/ArgMaxLower.cpp \
	Transforms/TensorSel/ArgMinLower.cpp \
	Transforms/TensorSel/AsinLower.cpp \
	Transforms/TensorSel/AtanLower.cpp \
	Transforms/TensorSel/AveragePoolLower.cpp \
	Transforms/TensorSel/BatchNormalizationLower.cpp \
	Transforms/TensorSel/CeilLower.cpp \
	Transforms/TensorSel/ClipLower.cpp \
	Transforms/TensorSel/ConcatLower.cpp \
	Transforms/TensorSel/ConvLower.cpp \
	Transforms/TensorSel/CosLower.cpp \
	Transforms/TensorSel/DivLower.cpp \
	Transforms/TensorSel/DropoutLower.cpp \
	Transforms/TensorSel/EqualLower.cpp \
	Transforms/TensorSel/ExpLower.cpp \
	Transforms/TensorSel/FlattenLower.cpp \
	Transforms/TensorSel/FloorLower.cpp \
	Transforms/TensorSel/GemmLower.cpp \
	Transforms/TensorSel/GlobalAveragePoolLower.cpp \
	Transforms/TensorSel/GlobalLpPoolLower.cpp \
	Transforms/TensorSel/GlobalMaxPoolLower.cpp \
	Transforms/TensorSel/GreaterLower.cpp \
	Transforms/TensorSel/HardmaxLower.cpp \
	Transforms/TensorSel/HardSigmoidLower.cpp \
	Transforms/TensorSel/IdentityLower.cpp \
	Transforms/TensorSel/ImageScalerLower.cpp \
	Transforms/TensorSel/InstanceNormalizationLower.cpp \
	Transforms/TensorSel/LeakyReluLower.cpp \
	Transforms/TensorSel/LessLower.cpp \
	Transforms/TensorSel/LogLower.cpp \
	Transforms/TensorSel/LogSoftmaxLower.cpp \
	Transforms/TensorSel/LpNormalizationLower.cpp \
	Transforms/TensorSel/LpPoolLower.cpp \
	Transforms/TensorSel/LRNLower.cpp \
	Transforms/TensorSel/MatMulLower.cpp \
	Transforms/TensorSel/MaxLower.cpp \
	Transforms/TensorSel/MaxPoolLower.cpp \
	Transforms/TensorSel/MeanLower.cpp \
	Transforms/TensorSel/MinLower.cpp \
	Transforms/TensorSel/MulLower.cpp \
	Transforms/TensorSel/MultinomialLower.cpp \
	Transforms/TensorSel/NegLower.cpp \
	Transforms/TensorSel/NotLower.cpp \
	Transforms/TensorSel/OrLower.cpp \
	Transforms/TensorSel/PadLower.cpp \
	Transforms/TensorSel/ParametricSoftplusLower.cpp \
	Transforms/TensorSel/PowLower.cpp \
	Transforms/TensorSel/PReluLower.cpp \
	Transforms/TensorSel/RandomNormalLower.cpp \
	Transforms/TensorSel/RandomNormalLikeLower.cpp \
	Transforms/TensorSel/RandomUniformLower.cpp \
	Transforms/TensorSel/RandomUniformLikeLower.cpp \
	Transforms/TensorSel/ReciprocalLower.cpp \
	Transforms/TensorSel/ReduceL1Lower.cpp \
	Transforms/TensorSel/ReduceL2Lower.cpp \
	Transforms/TensorSel/ReduceLogSumLower.cpp \
	Transforms/TensorSel/ReduceLogSumExpLower.cpp \
	Transforms/TensorSel/ReduceMaxLower.cpp \
	Transforms/TensorSel/ReduceMeanLower.cpp \
	Transforms/TensorSel/ReduceMinLower.cpp \
	Transforms/TensorSel/ReduceProdLower.cpp \
	Transforms/TensorSel/ReduceSumLower.cpp \
	Transforms/TensorSel/ReduceSumSquareLower.cpp \
	Transforms/TensorSel/ReluLower.cpp \
	Transforms/TensorSel/ReshapeLower.cpp \
	Transforms/TensorSel/ScaleLower.cpp \
	Transforms/TensorSel/ScaledTanhLower.cpp \
	Transforms/TensorSel/SeluLower.cpp \
	Transforms/TensorSel/ShapeLower.cpp \
	Transforms/TensorSel/SigmoidLower.cpp \
	Transforms/TensorSel/SinLower.cpp \
	Transforms/TensorSel/SizeLower.cpp \
	Transforms/TensorSel/SliceLower.cpp \
	Transforms/TensorSel/SoftmaxLower.cpp \
	Transforms/TensorSel/SoftsignLower.cpp \
	Transforms/TensorSel/SpaceToDepthLower.cpp \
	Transforms/TensorSel/SplitLower.cpp \
	Transforms/TensorSel/SqrtLower.cpp \
	Transforms/TensorSel/SqueezeLower.cpp \
	Transforms/TensorSel/SubLower.cpp \
	Transforms/TensorSel/SumLower.cpp \
	Transforms/TensorSel/TanLower.cpp \
	Transforms/TensorSel/TanhLower.cpp \
	Transforms/TensorSel/ThresholdedReluLower.cpp \
	Transforms/TensorSel/TileLower.cpp \
	Transforms/TensorSel/TopKLower.cpp \
	Transforms/TensorSel/TransposeLower.cpp \
	Transforms/TensorSel/UnsqueezeLower.cpp \
	Transforms/TensorSel/UpsampleLower.cpp \
	Transforms/TensorSel/XorLower.cpp \
	Core/PassRegistry.cpp \
	Core/PassManager.cpp \
	Core/PassInfo.cpp \
	Core/AnalysisUsage.cpp \
	Core/AnalysisResolver.cpp \
	Core/Pass.cpp \
	Core/ObjectWriter.cpp \
	Core/Application.cpp \
	Core/InitializePasses.cpp \
	Analysis/Counter.cpp \
	Analysis/LivenessAnalysis.cpp \
	Analysis/MemoryAllocation.cpp \
	Analysis/NodeIRScheduler.cpp \
	Analysis/SplitNode.cpp \
	Analysis/UpdateGraphOutputSize.cpp \
	Analysis/Statistics.cpp \
	Analysis/GlobalStatistics.cpp \
	CodeGen/BuildMemOperand.cpp \
	CodeGen/FuseInplaceValue.cpp \
	CodeGen/LinearScanMemAlloc.cpp \
	CodeGen/LiveInterval.cpp \
	CodeGen/LiveIntervals.cpp \
	CodeGen/LiveIntervalsData.cpp \
	CodeGen/LiveValueMatrix.cpp \
	CodeGen/MemAllocData.cpp \
	CodeGen/SetMemOperand.cpp \
	CodeGen/SlotIndexes.cpp \
	ADT/PolicyNodeIterator.cpp \
	ADT/Digraph.cpp \
	ADT/Buffer.cpp \
	ADT/ConstBuffer.cpp \
	ADT/Any.cpp \
	ADT/Color.cpp \
	ADT/TypeTag.cpp \
	ADT/TopologyIterator.cpp \
	ADT/IList.cpp \
	ADT/IListIterator.cpp \
	ADT/Rope.cpp \
	ADT/StringList.cpp \
	ADT/StringRef.cpp \
	Support/Debug.cpp \
	Support/AsyncPipe.cpp \
	Support/CArgu.cpp \
	Support/CArguRef.cpp \
	Support/CEnv.cpp \
	Support/Directory.cpp \
	Support/DirIterator.cpp \
	Support/ErrorCode.cpp \
	Support/Environ.cpp \
	Support/Expansion.cpp \
	Support/Glob.cpp \
	Support/Host.cpp \
	Support/IOStream.cpp \
	Support/IndentOStreamBuf.cpp \
	Support/ManagedStatic.cpp \
	Support/MappedFileRegion.cpp \
	Support/MemoryMap.cpp \
	Support/Path.cpp \
	Support/Pipe.cpp \
	Support/FileHandle.cpp \
	Support/FileLock.cpp \
	Support/FileInfo.cpp \
	Support/FileStatus.cpp \
	Support/FileSystem.cpp \
	Support/Timer.cpp \
	Support/Random.cpp \
	Support/Readline.cpp \
	Support/linenoise.cpp \
	Support/SelfPipe.cpp \
	Support/Signal.cpp \
	Support/Unix/AsyncPipe.inc \
	Support/Unix/Expansion.inc \
	Support/Unix/Glob.inc \
	Support/Unix/Path.inc \
	Support/Unix/Pipe.inc \
	Support/Unix/FileSystem.inc \
	Support/Unix/Random.inc \
	Support/Unix/SelfPipe.inc \
	Support/Windows/Path.inc \
	Support/Windows/FileSystem.inc \
	Support/Dragon/Path.inc \
	Support/Dragon/FileSystem.inc \
	JSON/Array.cpp \
	JSON/Group.cpp \
	JSON/Object.cpp \
	JSON/Value.cpp \
	JSON/JsonParser.ypp \
	JSON/JsonScanner.lpp \
	JSON/Storage.cpp \
	JSON/String.cpp \
	JSON/Notation.cpp \
	Diagnostic/Diagnostic.cpp \
	Diagnostic/DiagnosticInfoMap.cpp \
	Diagnostic/Engine.cpp \
	Diagnostic/GeneralOptions.cpp \
	Diagnostic/MsgHandler.cpp \
	Diagnostic/MsgHandling.cpp \
	Diagnostic/Policy.cpp \
	Diagnostic/Logger.cpp \
	Diagnostic/SysLog.cpp \
	Diagnostic/StreamLog.cpp \
	Config/AboutLicense.cpp \
	Config/AboutData.cpp \
	ONNXWrapper/ONNXWrapper.cpp \
	Option/Alias.cpp \
	Option/CommandLine.cpp \
	Option/OptDefs.cpp \
	Option/Option.cpp \
	Option/OptionPool.cpp \
	Option/OptParser.cpp \
	Runtime/Interpreter.cpp \
	Runtime/onnc-runtime.c \
	Runtime/operator/abs.c \
	Runtime/operator/acos.c \
	Runtime/operator/add.c \
	Runtime/operator/affine.c \
	Runtime/operator/and.c \
	Runtime/operator/argmax.c \
	Runtime/operator/argmin.c \
	Runtime/operator/asin.c \
	Runtime/operator/atan.c \
	Runtime/operator/aten.c \
	Runtime/operator/averagepool.c \
	Runtime/operator/batchnormalization.c \
	Runtime/operator/cast.c \
	Runtime/operator/ceil.c \
	Runtime/operator/clip.c \
	Runtime/operator/concat.c \
	Runtime/operator/constant.c \
	Runtime/operator/constantfill.c \
	Runtime/operator/conv.c \
	Runtime/operator/convtranspose.c \
	Runtime/operator/cos.c \
	Runtime/operator/crop.c \
	Runtime/operator/depthtospace.c \
	Runtime/operator/div.c \
	Runtime/operator/dropout.c \
	Runtime/operator/elu.c \
	Runtime/operator/equal.c \
	Runtime/operator/exp.c \
	Runtime/operator/expand.c \
	Runtime/operator/flatten.c \
	Runtime/operator/floor.c \
	Runtime/operator/gather.c \
	Runtime/operator/gemm.c \
	Runtime/operator/giventensorfill.c \
	Runtime/operator/globalaveragepool.c \
	Runtime/operator/globallppool.c \
	Runtime/operator/globalmaxpool.c \
	Runtime/operator/greater.c \
	Runtime/operator/gru.c \
	Runtime/operator/gruunit.c \
	Runtime/operator/hardmax.c \
	Runtime/operator/hardsigmoid.c \
	Runtime/operator/identity.c \
	Runtime/operator/if.c \
	Runtime/operator/imagescaler.c \
	Runtime/operator/instancenormalization.c \
	Runtime/operator/leakyrelu.c \
	Runtime/operator/less.c \
	Runtime/operator/log.c \
	Runtime/operator/logsoftmax.c \
	Runtime/operator/loop.c \
	Runtime/operator/lpnormalization.c \
	Runtime/operator/lppool.c \
	Runtime/operator/lrn.c \
	Runtime/operator/lstm.c \
	Runtime/operator/matmul.c \
	Runtime/operator/max.c \
	Runtime/operator/maxpool.c \
	Runtime/operator/maxroipool.c \
	Runtime/operator/mean.c \
	Runtime/operator/meanvariancenormalization.c \
	Runtime/operator/min.c \
	Runtime/operator/mul.c \
	Runtime/operator/multinomial.c \
	Runtime/operator/neg.c \
	Runtime/operator/not.c \
	Runtime/operator/or.c \
	Runtime/operator/pad.c \
	Runtime/operator/parametricsoftplus.c \
	Runtime/operator/pow.c \
	Runtime/operator/prelu.c \
	Runtime/operator/randomnormal.c \
	Runtime/operator/randomnormallike.c \
	Runtime/operator/randomuniform.c \
	Runtime/operator/randomuniformlike.c \
	Runtime/operator/reciprocal.c \
	Runtime/operator/reducel1.c \
	Runtime/operator/reducel2.c \
	Runtime/operator/reducelogsum.c \
	Runtime/operator/reducelogsumexp.c \
	Runtime/operator/reducemax.c \
	Runtime/operator/reducemean.c \
	Runtime/operator/reducemin.c \
	Runtime/operator/reduceprod.c \
	Runtime/operator/reducesum.c \
	Runtime/operator/reducesumsquare.c \
	Runtime/operator/relu.c \
	Runtime/operator/reshape.c \
	Runtime/operator/rnn.c \
	Runtime/operator/scale.c \
	Runtime/operator/scaledtanh.c \
	Runtime/operator/scan.c \
	Runtime/operator/selu.c \
	Runtime/operator/shape.c \
	Runtime/operator/sigmoid.c \
	Runtime/operator/sin.c \
	Runtime/operator/size.c \
	Runtime/operator/slice.c \
	Runtime/operator/softmax.c \
	Runtime/operator/softplus.c \
	Runtime/operator/softsign.c \
	Runtime/operator/spacetodepth.c \
	Runtime/operator/split.c \
	Runtime/operator/sqrt.c \
	Runtime/operator/squeeze.c \
	Runtime/operator/sub.c \
	Runtime/operator/sum.c \
	Runtime/operator/tan.c \
	Runtime/operator/tanh.c \
	Runtime/operator/thresholdedrelu.c \
	Runtime/operator/tile.c \
	Runtime/operator/topk.c \
	Runtime/operator/transpose.c \
	Runtime/operator/unsqueeze.c \
	Runtime/operator/upsample.c \
	Runtime/operator/xor.c

ONNC_INCLUDES = @LIBONNC_INCLUDES@ @ONNX_INCLUDES@ -I${srcdir}/Target

ONNC_LIBS = @ONNX_LIBS@

ONNC_CPPFLAGS=-Waddress -Wchar-subscripts -Wcomment -Wformat -Wparentheses -Wreorder -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var -Wno-return-stack-address

if ENABLE_DEBUG
ONNC_CPPFLAGS += -O0 -g3
endif

if ENABLE_OPTIMIZE
ONNC_CPPFLAGS += -O2 -DNDEBUG
endif

AM_CPPFLAGS = ${ONNC_INCLUDES} ${ONNC_CPPFLAGS}

AM_YFLAGS = -d
AM_LFLAGS = -olex.yy.c

#####################################
# Target-depednet files and settings
ONNC_TARGET_SOURCES = Target/Platform.cpp \
	Target/Target.cpp \
	Target/TargetRegistry.cpp \
	Target/TargetStandardPasses.cpp \
	Target/NPUTargetBackend.cpp

if ENABLE_X86_TARGET
include $(srcdir)/Target/X86/Makefile.am
endif

if ENABLE_NVDLA_TARGET
include $(srcdir)/Target/NvDla/Makefile.am
endif

# FIXME: embraced by flag?
include $(srcdir)/Target/Vanilla/Makefile.am
include $(srcdir)/Target/CLang/Makefile.am

#####################################
# Build shared libraries
lib_LIBRARIES = libonnc.a

libonnc_a_SOURCES = ${ONNC_SOURCES} ${ONNC_TARGET_SOURCES}

libonnc_a_LIBADD = ${ONNC_LIBS}

if HAVE_PTHREADS
libonnc_a_LDFLAGS = -lpthread
endif
